type Options = {
  redirect: boolean;
  noAuth: boolean;
  fullParams: boolean;
};

type Data = {
  redirect: string;
};
export default function (url, data: Data, options: Options) {
  let replace = false;
  if (options) {
    replace = true;
    if (!options?.noAuth) {
      replace = false;
    }
  }
  if (options?.redirect) {
    window.location.href = url + "?" + `redirect=${data.redirect}`;
  } else {
    if (typeof url === "number") {
      url == 0 ? (url = 1) : url;
      history.go(url);
      return;
    }
    navigateTo({
      path: url,
      query: data,
      replace,
    });
  }
}
